<template>
  <view>
    <uni-search-bar @confirm="() => ctx.search()" :focus="true" v-model="ctx.searchValue.value" placeholder="搜索关键字"
      @input="() => ctx.input()">
    </uni-search-bar>
    <fault-list />
    <view style="text-align: right; padding: 10rpx;" v-if="ctx.state.isAdmin">
      <text @click="() => ctx.add()">新增</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onShareAppMessage } from '@dcloudio/uni-app';
import { MainContext } from './scripts/MainContext'
import FaultList from './widgets/FaultList.vue'

const ctx = new MainContext()
ctx.provide()

onShareAppMessage((res) => {
  return {
    title: '故障查询',
    path: '/pages/index/index'
  }
})

</script>

<style scoped lang="scss"></style>
